from gomoku.game import Game
import copy

AI = Game()


async def AI_chessing(model, battledata):
    # print('模型得到的状态',battledata)
    m=copy.deepcopy(battledata)
    for i in m:     # -->日后提升性能这里可以优化
        if m.index(i)%2==1:
            i.pop()
            i.append(2)
    # print("重新计算后的棋盘状态",m)
    gt = AI.start_play(model=model, boardlist=m)        # 这里黑白双方的标志用错导致电脑计算能力下降
    return gt


def dumps_(_str):
    rt = []
    for i in range(len(_str)):
        rt.append(int(_str[i]))
    return rt


def load_(_list):
    for i in range(len(_list)):
        _list[i] = str()
    rt = ''.join(_list)
